/**
 * 产品分类列表
 * 文件命名格式：zmn.模块名称.表名称.功能.jas
 * @author duanzuocai
 * @since 2018/10/18
 */
layui.define(['index', 'form', 'table', 'laypage', 'layedit', 'laydate'], function (exports) {
    var $ = layui.$;
    var form = layui.form;
    var layer = layui.layer;
    var table = layui.table;
    var laypage = layui.laypage;

    var cols = [
        [
            {field: 'relateId', type: 'checkbox', fixed: 'left', width: 50, align: 'center'},
            {field: 'relateId', title: 'ID', width: 120, align: 'center', unresize: true, sort: false},
            {field: 'servCategName', title: '服务类型', width: 150, align: 'center', unresize: true, sort: false},
            {field: 'pointName', title: '网点名称', width: 200, align: 'center', unresize: true, sort: false},
            {field: 'pointProvince', title: '网点省', width: 150, align: 'center', unresize: true, sort: false},
            {field: 'pointCity', title: '网点市', width: 150, align: 'center', unresize: true, sort: false},
            {field: 'pointCounty', title: '网点区', width: 200, align: 'center', unresize: true, sort: false},
            {field: 'pointAddress', title: '网点地扯', align: 'center', unresize: false, sort: false}
        ]
    ];
    table.render({
        elem: "#zmn-pointserv-table",
        toolbar: "#zmn-pointserv-table-tool",
        title: "关联列表",
        data: json.items,
        limit: json.pageSize,
        cols: cols,
        page: true,
        height: 'full-120'
    });

    laypage.render(zmnPage.laypageOptions(json));

    var ids = new Array();

    // 选择（全选或单选）
    table.on("checkbox(zmn-pointserv-table)", function () {
        ids = zmnPage.layIdsChecked(json.items, "relateId");
    });

    // 删除
    table.on("toolbar(zmn-pointserv-table)", function (obj) {
        if (obj.event != "del") {
            return;
        }
        if (ids.length === 0) {
            return layer.alert("请选择至少一条要删除的数据！");
        }
        zmnPage.layStartStop(obj, "/point/servitem/del.action", ids.join(","));
    });

    zmnPage.laySelectLinkage(form, "/common/area/listChilds.action", "provinceId", "cityId", null);

    //对外暴露的接口
    exports('art_point_serv_list', {});
});